﻿// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

using FreshMeat.Storage;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Storage.More.Test
{
   [TestClass]
   public class FileRepositoryTest : CommonRepositoryTest
   {
      protected override IRepository<int, Item> CreateRepository()
      {
         var rootFolder = System.IO.Path.Combine(TestContext.TestDir, System.IO.Path.GetRandomFileName());
         var fileSystem = new FileSystem(rootFolder);
         var fileLocator = new FileLocator<int>(fileSystem, false, ".test", int.Parse);

         var repo = new FileRepository<int, Item>(item => item.Id, fileLocator, new JsonSerializer<Item>());
         return repo;
      }

      // ReSharper disable MemberCanBePrivate.Global
      // ReSharper disable UnusedAutoPropertyAccessor.Global
      public TestContext TestContext { get; set; }
      // ReSharper restore UnusedAutoPropertyAccessor.Global
      // ReSharper restore MemberCanBePrivate.Global
   }
}